format amount in javascript

51

Number format in javascript -

function numberWithCommas(x) {
    return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

Comments

Submit
0 Comments